//
//  UserInfoSession.swift
//  DigitalMuseum
//
//  Created by zhongshan on 2024/2/21.
//

import Foundation

final class UserInfoSession {
    static let shared = UserInfoSession()
    
    private init() {}
    
    @UserDefaultCustomOptional(key: "com.dm.udkey.userInfo", defaultValue: nil)
    private(set) var userInfo: UserInfo?
    
    var isLogin: Bool {
        userInfo != nil
    }
    
    func save(_ userInfo: UserInfo) {
        self.userInfo = userInfo
    }
    
    func clean() {
        self.userInfo = nil
    }
}
